// pages/student/mine/set/set.js
import {
    ajaxPost,
    showToast
} from '../../../../utils/util'
Page({

    /**
     * 页面的初始数据
     */
    data: {
        type: 0,
        hideVal: false,
    },

    /**
     * 生命周期函数--监听页面加载
     */
    onLoad: function (options) {
        if (options.type == 0 || options.type == 1) {
            this.setData({
                type: options.type,
                hideVal: false
            })
        }
        if (options.type == 2) {
            this.setData({
                type: options.type,
                hideVal: true
            })
        }
    },
    changeHide(e) {
        if (this.data.type == 0) {
            this.setData({
                hideVal: false
            })
            wx.showModal({
                title: '操作提示',
                content: '简历还没有完善，请完善简历后重试',
                success(res) {
                    if (res.confirm) {
                        wx.navigateBack({
                            delta: 1
                        })
                    }
                }
            })
            return;
        }
        let data = {
            token: wx.getStorageSync('token')
        }
        ajaxPost('/authuser/hideResume', data, res => {
            if (res.code == 0) {
                showToast('text', res.msg)
                this.setData({
                    hideVal: e.detail.value
                })
            }
        })

    }
})